<?php include (dirname(__FILE__)."/../include/header.php"); ?>
<?php if(!isset($_SESSION['_shop'])){header("location:../user_login.php");}?>
<?php 
	$sql=mysql_query("select * from zy_shop where shop_id='".$_SESSION['_shop']['shop_id']."'");
	$shop=mysql_fetch_array($sql);
	$method = $_REQUEST['method'];
	if($method == "update")
	{
		$shop_address=$_POST['shop_address'];
		$shop_phone=$_POST['shop_phone'];
		$description=$_POST['description'];
		$introduction=$_POST['introduction'];
		$announce=$_POST['announce'];
		$start_price=$_POST['start_price'];
		$surcharge=$_POST['surcharge'];
		$district=$_POST['district'];
		$distance=$_POST['distance'];
		$opening_hours=$_POST['opening_hours'];
		$delivery_time=$_POST['delivery_time'];
		$delivery_long=$_POST['delivery_long'];
		$shop_type=$_POST['shop_type'];
		$shop_type=implode("|", $shop_type);
		$updateUsername = $_SESSION['_shop']['username'];
		if($shop_address!="" && $shop_phone!="" && $description!="" && $introduction!="" && $announce!="" && $start_price!="" && $district!="" && $distance!="" && $opening_hours!="" && $delivery_time!="" && $delivery_long!="" && $shop_type!=""){
		$sql = "update zy_shop set shop_address='".$shop_address."',shop_phone='".$shop_phone."',logo='".$shop['logo']."',description='".$description."',introduction='".$introduction."',announce='".$announce."',start_price='".$start_price."',surcharge='".$surcharge."',district='".$district."',distance='".$distance."',opening_hours='".$opening_hours."',delivery_time='".$delivery_time."',delivery_long='".$delivery_long."',shop_type='".$shop_type."',create_time=NOW(),update_user='".$create_user."' where zy_shop.shop_id=".$_SESSION['_shop']['shop_id'];
		mysql_query($sql);
		header("location:shop_management.php");
		}else{
			$error="填写信息不能为空！";
		}
	}
?>

<div class="container">
  <ul class="breadcrumb">
    <li> 店铺名称 <span class="divider">/</span> </li>
    <li><a href="<?php echo SITE_ROOT;?>/shop/edit_password.php"">修改密码</a></li>
  </ul>
  <div class="row">
    <div class="span12 wash-paper user-center profile">
      <div class="row">
        <div class="span3">
          <?php include (dirname(__FILE__)."/../include/shop/left.php"); ?>
          <div class="span9">
            <div class="main-content">
              <div class="content-header">
                <h3>店铺信息修改</h3>
              </div>
              <div class="field_line" ><font color="red"><?php echo $error;?></font></div>
              <div class="content-inner changepwd">
                <form class="form-horizontal" method="post" id="form" action="<?php echo SITE_ROOT;?>/shop/shop_edit.php?method=update">
                  <fieldset>
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>加盟时间：</label>
                    <div class="controls"> <?php echo $shop['shop_name']?>
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>店铺地址：</label>
                    <div class="controls">
                      <input name="shop_address" class="span4" id="sf_guard_user_old_pwd" type="text" value="<?php echo $shop['shop_address']?>" />
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>店铺电话：</label>
                    <div class="controls">
                      <input name="shop_phone" class="span4" id="sf_guard_user_old_pwd" type="text" value="<?php echo $shop['shop_phone']?>" />
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>加盟时间：</label>
                    <div class="controls"> <?php echo $shop['join_time']?>
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>店铺描述：</label>
                    <div class="controls">
                      <textarea class="span4" name="description" id="description" rows="3"><?php echo $shop['description']?></textarea>
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>店铺简介：</label>
                    <div class="controls">
                      <textarea class="span4" name="introduction" id="introduction" rows="3"><?php echo $shop['introduction']?></textarea>
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>店内公告：</label>
                    <div class="controls">
                      <textarea class="span4" name="announce" id="announce" rows="3"><?php echo $shop['announce']?></textarea>
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>起送价格：</label>
                    <div class="controls">
                      <input name="start_price" class="span4" id="sf_guard_user_old_pwd" type="text" value="<?php echo $shop['start_price']?>" />
                      <p class="help-block"></p>
                    </div>
					 <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>外送费用：</label>
                    <div class="controls">
                      <input name="surcharge" class="span4" id="surcharge" type="text" value="<?php echo $shop['surcharge']?>" />
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>商圈范围：</label>
                    <div class="controls">
                      <input name="district" class="span4" id="sf_guard_user_old_pwd" type="text" value="<?php echo $shop['district']?>" />
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>商圈距离：</label>
                    <div class="controls">
                      <input name="distance" class="span4" id="sf_guard_user_old_pwd" type="text" value="<?php echo $shop['distance']?>" />
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>营业时间：</label>
                    <div class="controls">
                      <input name="opening_hours" class="span4" id="sf_guard_user_old_pwd" type="text" value="<?php echo $shop['opening_hours']?>" />
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>送餐时间：</label>
                    <div class="controls">
                      <input name="delivery_time" class="span4" id="sf_guard_user_old_pwd" type="text" value="<?php echo $shop['delivery_time']?>" />
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>送餐时长：</label>
                    <div class="controls">
                      <input name="delivery_long" class="span4" id="sf_guard_user_old_pwd" type="text" value="<?php echo $shop['delivery_long']?>" />
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="control-group clear-fix">
                    <label class="control-label" for=""><span class="required">*</span>餐厅类型：</label>
                    <div class="controls">
	  <input type="checkbox" class="checkbox" name="shop_type[]" value="[a1]" <?php if(strpos($shop['shop_type'],"a1")>0){?> checked <?php }?>/>本周推荐
	  <input type="checkbox" class="checkbox" name="shop_type[]" value="[a2]" <?php if(strpos($shop['shop_type'],"a2")!=false){?> checked <?php }?>/>江浙菜
	  <input type="checkbox" class="checkbox" name="shop_type[]" value="[a3]" <?php if(strpos($shop['shop_type'],"a3")!=false){?> checked <?php }?>/>快餐小吃
	  <input type="checkbox" class="checkbox" name="shop_type[]" value="[a4]" <?php if(strpos($shop['shop_type'],"a4")!=false){?> checked <?php }?>/>日韩料理
	  <input type="checkbox" class="checkbox" name="shop_type[]" value="[a5]" <?php if(strpos($shop['shop_type'],"a5")!=false){?> checked <?php }?>/>川菜
	  <input type="checkbox" class="checkbox" name="shop_type[]" value="[a6]" <?php if(strpos($shop['shop_type'],"a6")!=false){?> checked <?php }?>/>奶茶甜点
                      <p class="help-block"></p>
                    </div>
                    <!--end input-->
                  </div>
                  <!--end clearfix-->
                  <div class="form-actions">
                    <input type="submit" class="btn btn-yellow" id="sf_guard_user_changepwd_submit" name="submit" value="提交更改">
                  </div>
                  </fieldset>
                </form>
              </div>
              <!--end contentarea-->
            </div>
            <!--end marin-content-->
          </div>
        </div>
      </div>
    </div>
  </div>
  <a id="back-to-top" href="javascript:void(0);">
  <div class="backtotop"></div>
  </a> </div>
<?php include (dirname(__FILE__)."/../include/footer.php"); ?>
